<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="content-type" content="text/html" charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui" />
    <meta name="format-detection" content="telephone=no">
    <title>{{$list['c_name']}}转出</title>
    <script src="{{asset('/admin/layui/layui.all.js') }}"></script>
    <link rel="stylesheet" href="{{asset('/admin/layui/css/layui.css') }}" />

    <link rel="stylesheet" href="{{asset('/api/static/css/base.css')}}">
    <link rel="stylesheet" href="{{asset('/api/static/css/index.css')}}">
    <link rel="stylesheet" href="{{asset('/api/static/css/transfer.css?v=5')}}">

</head>
<body>
<form class="form-horizontal" id="myform" role="form">{{csrf_field()}}

<section class="tlb-out-wrap">
    <section class="num-title clearfix out-title">
      <span class="fl">
        可用 <i class="is-available">{{$list['balance']}}</i>
      </span>
        <span class="fr">
        冻结 <i>{{$list['blocked']}}</i>
      </span>
    </section>
    <section class="out-messages">
        <ul class="msg-list">
            <li class="clearfix">
                <span class="fl">钱包地址</span> <input class="fl url-input" name="address" type="text" placeholder="请输入钱包地址">
            </li>
            <li class="clearfix">
                <span class="fl">转出数量</span> <input class="fl num-input" name="num" value="" type="text" placeholder="请输入转出数量">
                <a class="fr num-out-all">全部转出</a>
            </li>
            <li class="clearfix">
                <input name="cid" value="{{$cid}}" type="hidden">
                <input name="uid" value="{{$uid}}" type="hidden">
                <span class="fl">交易密码</span> <input name="psd" class="fl password-input" type="password" placeholder="请输入交易密码">
            </li>
        </ul>
    </section>
    <section class="blue big-btn"  onclick="on_add()">
        确认转出
    </section>
    <section class="tips">
      <section class="title">转出说明</section>
      <p>1、转出虚拟币需要人工审核，在9:00-21:00的提币审核我们将尽快加速处理</p>
      <p>2、我们会为每次转币支付网络费，但由于网络的不确定性，部分转币可能会有延迟，请您谅解</p>
      <p>3、转出的服务费为0.2%{{$list['c_name']}}</p>
    </section>
</section>
</form>
<script src="{{asset('/api/static/js/jquery-1.10.2.min.js')}}"></script>
<script src="{{asset('/api/static/js/base.js')}}"></script>
<script src="{{asset('/api/static/js/rem.js')}}"></script>

<script>
    var turnOutSubmit = true
    function on_add() {
        if( $('input[name=address]').val()=='' ){
            layer.msg('请输入钱包地址',{icon:2})
            return
        }
        if( $('input[name=num]').val()=='' ){
            layer.msg('请输入转出数量',{icon:2})
            return
        }
        if( $('input[name=psd]').val().length<6 ){
            layer.msg('请输入6位交易密码',{icon:2})
            return
        }
        turnOutSubmit = false
        $.ajax({
            type : "POST",
            async: false,
            url:'/api/turn_out_submit',
            data : $('#myform').serialize(),
            success: function(res){
                if(res.status == 1){
                    layer.msg('转出成功',{icon:1})
                    $('#myform').get(0).reset()
                    setTimeout(function(){
                        window.location.reload()
                    }, 1500)
                }else{
                    layer.msg(res.msg, {icon: 2});
                    // $('.form-horizontal').reset()
                }
            }
        });
        turnOutSubmit = true
    }
    $(document).on('input propertychange', '.num-input', function(){
        var numVal = $(this).val()
        $(this).val( floatNum( numVal, 8 ) )
        var is_ava = $(".is-available").text();   // 左上角的数字
        if( parseFloat( $(this).val() ) > parseFloat( is_ava ) ){
            layer.msg('不能大于可用资产',{icon:2})
            $(this).val('')
        }
    })
    function getQRcode(codeNum){ // 给原生用的，扫码
        // alert(codeNum)
        // alert(typeof codeNum)
        $('.url-input').val( codeNum );
    }
    $(".num-out-all").on("click",function () {
        var is_ava = $(".is-available").text();   // 左上角的数字
        $(".num-input").val(is_ava);
    })
</script>
</body>
</html>
